package com.neulogistics.contrib.transfercenter.api.application.integrationevent.handler;

import com.blackto.lib.eventbus.abstraction.IIntegrationEventHandler;
import com.neulogistics.contrib.transfercenter.api.application.integrationevent.subscribe.PurchaseInboundIntegrationEvent;
import com.neulogistics.contrib.transfercenter.infrastructure.persistence.orm.service.ITransferOrderPOService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.CompletableFuture;

@Component
public class PurchaseInboundIntegrationEventHandler implements IIntegrationEventHandler<PurchaseInboundIntegrationEvent> {
    @Resource
    ITransferOrderPOService transferOrderPOService;

    @Override
    public CompletableFuture<Void> handle(PurchaseInboundIntegrationEvent event) {
        transferOrderPOService.notifySuspendTransferOrderByWarehouse(
                event.warehouseId, event.goodsId);

        return CompletableFuture.completedFuture(null);
    }
}
